define([
  'backbone',
  'utils/Logger',
  'collections/AlertMessages',
  'views/AlertBoxMessagesView'
], function(Backbone, Logger, AlertMessages, AlertBoxMessagesView){
  var Router = Backbone.Router.extend({
    initialize: function() {
      this.messages = new AlertMessages();
      this.messagesView = new AlertBoxMessagesView({collection: this.messages});
    },
    
    // navigate to the current route
    getRoute: function() {
      // (override in subclasses)
      return '';
    },
    
    // update the url based on the current state
    updateRoute: function() {
      this.navigate(this.getRoute());
    },
    
    // update the url if this router's view is the top view
    updateViewRoute: function() {
      if (this.topview && this.topview == batzen.state.get('topview')) {
        this.updateRoute();
      }
    }
    
  });

  Router.prototype.Logger = Logger;
  
  return Router;
});
